package com.zyq.controller;

import com.zyq.annotation.AccessLimit;
import com.zyq.annotation.PreAuthorize;
import com.zyq.constant.AccessLimits;
import com.zyq.constant.Constant;
import com.zyq.util.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class Test {


    @AccessLimit(count = Constant.AccessLimit.count,timeOut = 10000,type = AccessLimits.Type.COUNT)
    @GetMapping("/add")
    public R<String> add(){
        /*List<UserEntity> data = new ArrayList<>();
        for (int i = 0; i < 23; i++) {
            UserEntity userEntity = new UserEntity();
            userEntity.setId(i + "");
            userEntity.setUsername("小二" + i);
            data.add(userEntity);
        }
        userService.saveBatch(data);*/
        return R.ok();
    }

    @PreAuthorize(login = false)
    @GetMapping("/edit")
    public R<String> edit(){
        /*List<UserEntity> data = new ArrayList<>();
        for (int i = 0; i < 23; i++) {
            UserEntity userEntity = new UserEntity();
            userEntity.setId(i + "");
            userEntity.setUsername("小二" + i);
            data.add(userEntity);
        }
        userService.saveBatch(data);*/
        return R.ok();
    }
}
